import * as vscode from 'vscode';
import { ProjectProvider, ProjectItem } from './projectProvider';
import { GiteeApi } from './giteeApi';
import { GistProvider } from './gistProvider';

export function activate(context: vscode.ExtensionContext) {
	const api = new GiteeApi();
	const projectProvider = new ProjectProvider(api);
	const gistProvider = new GistProvider(api);

	vscode.window.registerTreeDataProvider('project', projectProvider);
	vscode.window.registerTreeDataProvider('gist', gistProvider);
	vscode.commands.registerCommand('gitee.refreshProject', () => projectProvider.refresh());
	vscode.commands.registerCommand('gitee.createProject', () => projectProvider.create());
	vscode.commands.registerCommand('gitee.moreProject', () => projectProvider.more());
	vscode.commands.registerCommand('gitee.deleteProject', (node: ProjectItem) => projectProvider.delete(node));
	
	vscode.commands.registerCommand('gitee.refreshGist', () => gistProvider.refresh());
	vscode.commands.registerCommand('gitee.moreGist', () => gistProvider.more());
}

export function deactivate() {}
